package cn.myapp.ipc;

import java.util.ArrayList;
import java.util.List;

import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;

public class WorkService extends Service {

	public String tag = "cn.myapp.ipc";

	@Override
	public IBinder onBind(Intent intent) {
		InnerBinder binder = new InnerBinder();
		return binder;
	}
	
	private class InnerBinder extends IMusicPlayer.Stub {


		@Override
		public void play() {
			Log.v(tag , "InnerBinder.play()");
		}

		@Override
		public void pause() {
			Log.v(tag, "InnerBinder.pause()");
		}

		@Override
		public int getCurrentPosition() {
			Log.v(tag, "InnerBinder.getCurrentPosition()");
			return 0;
		}

		@Override
		public int getDuration() {
			Log.v(tag, "InnerBinder.getDuration()");
			return 0;
		}

		@Override
		public boolean isPlaying() {
			Log.v(tag, "InnerBinder.isPlaying()");
			return false;
		}

		@Override
		public List<Music> getMusicList() throws RemoteException {
			List<Music> musics = new ArrayList<Music>();
			Music music = null;
			
			music = new Music();
			music.setName("001");
			music.setPath("/mnt/sdcard/Music/001.mp3");
			music.setDuration(2495273);
			musics.add(music);
			
			music = new Music();
			music.setName("002");
			music.setPath("/mnt/sdcard/Music/002.mp3");
			music.setDuration(2895278);
			musics.add(music);
			
			music = new Music();
			music.setName("007");
			music.setPath("/mnt/sdcard/Music/007.mp3");
			music.setDuration(3295276);
			musics.add(music);
			
			return musics;
		}

		
	}
	
	
	
	
	
	
	
	

}
